package main.java.com.introduce;

import java.util.Date;
import java.util.Enumeration;
import java.util.Vector;

/**
 * @description: 账目
 * @author: cong zhi
 * @createDate: 2022/5/26 8:06
 * @updateUser: cong zhi
 * @updateDate: 2022/5/26 8:06
 * @updateRemark: 修改内容
 * @version: v1.0
 */
public class Account {

    public double getFlowBetween(Date start, Date end) {
        double result = 0;
        Enumeration e = entries.elements();
        while (e.hasMoreElements()) {
            Entry each = (Entry) e.nextElement();
            if (each.getDate().equals(start) ||
                    each.getDate().equals(end) || (each.getDate().after(start) && each.getDate().before(end))) {
                result += each.getValue();
            }
        }
        return result;
    }


    private Vector entries = new Vector();
}
